|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Facemorph.tensor.Multilinear
public class Multilinear
Multilinear model class
Constructor Summary | |
---|---|
Multilinear(Tensor T,
int dataDim,
double maxvar)
Creates a new instance of Multilinear Performs PCA along each of the plane average vectors Replace residuals with best linear fit etc etc |
Method Summary | |
---|---|
double[][] |
convertParams(double[] params)
Convert the parameters to multi-linear |
static double |
dotProduct(double[] v1,
double[] v2)
Find the dot product between two vectors |
double[][] |
getALSParams(double[] test)
Get Alternating Least Squares (ALS) parameters |
double[] |
getAverage()
Get the average |
double[][] |
getBestFitEdgeParams(double[] test)
Gets the best parameters from the edge (linear) components |
double[] |
getEdgeComp(int index)
Get a component along the edges |
static Multilinear |
getImageMultilinear(int[] dims,
java.util.Vector<java.awt.Image> images,
double maxvar)
Get a multilinear model from a set of images |
static Multilinear |
getTemplateMultilinear(int[] dims,
java.util.Vector<Template> templates,
double maxvar)
Get a MultiLinear object from the Templates |
int |
getTotalParams()
Get the total number of parameters |
static void |
main(java.lang.String[] args)
Main method for testing |
static int[] |
readImagesAndTemplates(java.lang.String listFile,
java.util.Vector<Template> templates,
java.util.Vector<java.awt.Image> images,
java.util.Vector<java.lang.String> temNames,
java.util.Vector<java.lang.String> imgNames)
Read images and templates from a file |
double[] |
reconstruct(double[][] params)
Reconstruct from parameters |
double[] |
reconstructEdgeParams(double[][] params)
Reconstruct using only the edge parameters |
double[] |
reconvertParams(double[][] params)
Creates a single vector from the edge parameters |
static void |
testLinear(java.lang.String[] args)
Test of linear building method |
static FloatImage[] |
unvectoriseColourFloatImage(double[] rgb,
int width,
int height)
Unvectorise an image to an array of FloatImage |
static java.awt.Image |
unvectoriseImage(double[] rgb,
int width,
int height)
Unvectorise an image |
static double[] |
vectoriseColourFloatImage(FloatImage[] rgb)
Vectorise 3 plane RGB image into a 1D vector |
static double[] |
vectoriseImage(java.awt.Image img)
Vectorise an image into a 1D vector |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Multilinear(Tensor T, int dataDim, double maxvar) throws BigMatException
T
- the input TensordataDim
- the data dimensionmaxvar
- the maximum variance to explain in any dimension
BigMatException
Method Detail |
---|
public double[] getAverage()
public static double dotProduct(double[] v1, double[] v2)
v1
- the first vectorv2
- the second vector
public double[] getEdgeComp(int index)
index
- the index of the component
public double[] reconstructEdgeParams(double[][] params)
params
- the parameters
public int getTotalParams()
public double[][] getBestFitEdgeParams(double[] test)
test
- the vector to analyse
public double[][] getALSParams(double[] test)
test
- the intput vector
public double[] reconstruct(double[][] params) throws BigMatException
params
- the parameters
BigMatException
public double[] reconvertParams(double[][] params)
params
- the intpu Tensor paraameters
public double[][] convertParams(double[] params)
params
- the parameters to convert
public static Multilinear getTemplateMultilinear(int[] dims, java.util.Vector<Template> templates, double maxvar) throws BigMatException
dims
- the number of dimensionstemplates
- the templatesmaxvar
- the maximum variation to explain
BigMatException
public static double[] vectoriseImage(java.awt.Image img)
img
- the image to vectorise
public static java.awt.Image unvectoriseImage(double[] rgb, int width, int height)
rgb
- the data vector to unvectorisewidth
- the width of the output imageheight
- the height of the output image
public static FloatImage[] unvectoriseColourFloatImage(double[] rgb, int width, int height)
rgb
- the vectorwidth
- the output widthheight
- the output height
public static double[] vectoriseColourFloatImage(FloatImage[] rgb)
rgb
- the intput image in 3 planes
public static Multilinear getImageMultilinear(int[] dims, java.util.Vector<java.awt.Image> images, double maxvar) throws BigMatException
dims
- the size of each dimensionimages
- the imagesmaxvar
- the maximum variance to explain along each dimension
BigMatException
public static int[] readImagesAndTemplates(java.lang.String listFile, java.util.Vector<Template> templates, java.util.Vector<java.awt.Image> images, java.util.Vector<java.lang.String> temNames, java.util.Vector<java.lang.String> imgNames)
listFile
- the file containing the file namestemplates
- the vector to put the templates inimages
- the array to put the images intemNames
- the output vector of template namesimgNames
- the output vector of image names
public static void main(java.lang.String[] args) throws BigMatException
args
- the program args (currently testLinear)
BigMatException
public static void testLinear(java.lang.String[] args) throws BigMatException
args
- args[0] - list file, args[1] - width, args[2] - height, args[3] - mask, args[4] - test list
BigMatException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |