|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectFacemorph.oesf.OESF
public class OESF
Implementation of Optimal Synthetic Exact Filters
Constructor Summary | |
---|---|
OESF()
|
Method Summary | |
---|---|
FloatImage |
bootstrapBuildFilter(java.lang.String file,
HaarReader haar,
boolean orientation,
int[] plist)
Build a set of OESF filters from a set of images and one labeled example |
FloatImage[] |
buildFilter(java.lang.String file,
HaarReader haar,
boolean orientation,
int[] plist)
Build a set of OESF filters |
FloatImage |
buildFilter(java.lang.String file,
HaarReader haar,
int[] plist)
Build an OESF filter |
FloatImage |
buildFilterBoosted(java.lang.String file,
HaarReader haar,
int point)
Build a set of OESF filters |
void |
buildFilterCascade(java.lang.String file,
HaarReader haar,
int point,
java.util.ArrayList<FloatImage> filters,
java.util.ArrayList<java.lang.Float> thresholds,
java.util.ArrayList<Complex[]> filterFTs,
java.util.ArrayList<double[]> priorsParams,
java.util.ArrayList<FloatImage> priors)
Build a set of OESF filters |
java.util.ArrayList<FloatImage> |
buildFilterMultiply(java.lang.String file,
HaarReader haar,
int point)
Build a set of OESF filters |
FloatImage |
buildFilterWeighted(java.lang.String file,
HaarReader haar,
int point)
Build a set of OESF filters |
java.util.ArrayList<java.lang.Float> |
calculateErrors(java.util.ArrayList<Complex[]> images,
java.util.ArrayList<java.awt.geom.Point2D.Float> points,
int[] dim,
java.util.ArrayList<java.lang.Float> maxResp)
|
static java.util.ArrayList<java.lang.Float> |
calculateErrors(Complex[] filterFT,
FloatImage priorFimg,
java.util.ArrayList<Complex[]> images,
java.util.ArrayList<java.awt.geom.Point2D.Float> points,
int[] dim,
java.util.ArrayList<java.lang.Float> maxResp)
|
java.util.ArrayList<java.lang.Float> |
calculateMultiplyErrors(java.util.ArrayList<FloatImage> filters,
java.util.ArrayList<Complex[]> images,
java.util.ArrayList<java.awt.geom.Point2D.Float> points,
int[] dim,
java.util.ArrayList<java.lang.Float> maxResp)
|
static FloatImage |
centre(FloatImage fimg)
Shift the origin to centre for easier human veiwing / interpretation |
static FloatImage |
convert(Complex[] a,
int w,
int h)
Converts an array of Complex back into a FloatImage, discarding imaginary components |
static Complex[] |
convert(FloatImage fimg)
Scan converts a FloatImage to an array of Complex |
static Complex[] |
convert(FloatImage[] fimg)
Converts a pair of FloatImages {real, imaginary} into a Complex array |
static FloatImage[] |
convertComplex(Complex[] a,
int w,
int h)
Convert a Complex array into a pair of FloatImages {real, imaginary} |
static java.awt.Rectangle |
detectFace(java.awt.image.BufferedImage bimg,
HaarReader haar)
Detect a face |
static java.awt.Rectangle |
detectFace(java.awt.image.BufferedImage bimg,
HaarReader haar,
java.awt.Rectangle prevRect)
Detect a face |
static java.awt.geom.Point2D.Float |
detectFeature(Complex[] img,
Complex[] filt,
FloatImage prior,
int[] dim)
|
static java.awt.geom.Point2D.Float |
detectFeature(Complex[] img,
Complex[] filt,
int[] dim)
|
static FloatImage |
filter(Complex[] data,
Complex[] filt,
int[] dim)
Apply a filter to an image |
static FloatImage |
filter(FloatImage fimg,
Complex[] filt,
int[] dim)
Apply a filter to an image |
static FloatImage |
filter(FloatImage fimg,
FloatImage filt,
int[] dim)
Apply a filter to an image |
static FloatImage[] |
filterComplex(FloatImage fimg,
Complex[] filt,
int[] dim)
Filters a real image with a complex filter |
static Complex[] |
getBoostResponse(float x,
float y,
int[] dim,
double s)
Create an idealised response image for boosting algorithm |
static FloatImage |
getBoostResponseReal(float x,
float y,
int[] dim,
double s)
Create an idealised response image for boosting algorithm |
static Complex[] |
getMultiResponse(Template tem,
int[] plist,
int[] dim)
Get an idealised response image for all listed features in the Template |
static Complex[] |
getResponse(float x,
float y,
double angle,
int[] dim)
Get the response image with orientation information (trying to detect orientation doesn't seem to work all that well) |
static Complex[] |
getResponse(float x,
float y,
int[] dim)
Create an idealised response image |
static boolean |
hasNextQuotedString(java.util.Scanner sc)
Returns true if the next token is the beginning of a quoted string value. |
FloatImage |
iterateBoosted(java.util.ArrayList<Complex[]> imagesFT,
java.util.ArrayList<Complex[]> responsesFT,
java.util.ArrayList<java.awt.geom.Point2D.Float> points,
java.util.ArrayList<Complex[]> imagesFTTest,
java.util.ArrayList<java.awt.geom.Point2D.Float> pointsTest,
int[] dim)
Build a set of OESF filters |
static void |
main(java.lang.String[] args)
Main method used for testing |
static java.lang.String |
nextQuotedString(java.util.Scanner sc)
Scans a quoted string value from the scanner input. |
static void |
preprocess(FloatImage fimg)
Preprocess the image using a log transform (y=log(1+x)), normalis mean and sd and sine window |
void |
read(java.lang.String dir)
Read an OESF filter from file |
static void |
testFilter(java.lang.String file,
java.util.ArrayList<FloatImage> filters,
FloatImage prior,
HaarReader haar,
int[] plist)
Test the filter |
static void |
testFilterComplex(java.lang.String file,
java.util.ArrayList<FloatImage[]> filters,
FloatImage prior,
HaarReader haar)
Test the complex filter |
void |
write(java.lang.String dir)
Writes the filters and prior data to file |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OESF()
Method Detail |
---|
public static Complex[] convert(FloatImage fimg)
fimg
- the FloatImage to convert
public static Complex[] convert(FloatImage[] fimg)
fimg
- the pair of images to convert
public static FloatImage convert(Complex[] a, int w, int h)
a
- the complex array of dataw
- the output widthh
- the output height
public static FloatImage[] convertComplex(Complex[] a, int w, int h)
a
- the Complex arrayw
- the output widthh
- the output height
public static void preprocess(FloatImage fimg)
fimg
- the image to preprocesspublic static Complex[] getResponse(float x, float y, int[] dim)
x
- the x-coord of the featurey
- the y-coord of the featuredim
- the dimensions of the Complex array, should be {128, 128}
public static Complex[] getBoostResponse(float x, float y, int[] dim, double s)
x
- the x-coord of the featurey
- the y-coord of the featuredim
- the dimensions of the Complex array, should be {128, 128}
public static FloatImage getBoostResponseReal(float x, float y, int[] dim, double s)
x
- the x-coord of the featurey
- the y-coord of the featuredim
- the dimensions of the Complex array, should be {128, 128}
public static Complex[] getMultiResponse(Template tem, int[] plist, int[] dim)
tem
- the Templateplist
- the list of points from the Template to usedim
- the dimension (should be {128, 128}
public static Complex[] getResponse(float x, float y, double angle, int[] dim)
x
- the x-coordy
- the y-coordangle
- the angle of the feature rotationdim
- the dimensionality should be {128, 128}
public FloatImage buildFilter(java.lang.String file, HaarReader haar, int[] plist) throws java.io.FileNotFoundException, java.io.IOException
file
- list of images in a filehaar
- face detectorplist
- list of points to use from each template (only the first point is returned)
java.io.FileNotFoundException
java.io.IOException
public FloatImage[] buildFilter(java.lang.String file, HaarReader haar, boolean orientation, int[] plist) throws java.io.FileNotFoundException, java.io.IOException
file
- the name of the file containing the list of images and templatehaar
- the face detectororientation
- idicates that we want to try and learn detectors that give us the orientationplist
- the list of points to use from the templates
java.io.FileNotFoundException
java.io.IOException
public void buildFilterCascade(java.lang.String file, HaarReader haar, int point, java.util.ArrayList<FloatImage> filters, java.util.ArrayList<java.lang.Float> thresholds, java.util.ArrayList<Complex[]> filterFTs, java.util.ArrayList<double[]> priorsParams, java.util.ArrayList<FloatImage> priors) throws java.io.FileNotFoundException, java.io.IOException
file
- the name of the file containing the list of images and templatehaar
- the face detectororientation
- idicates that we want to try and learn detectors that give us the orientationplist
- the list of points to use from the templates
java.io.FileNotFoundException
java.io.IOException
public FloatImage buildFilterWeighted(java.lang.String file, HaarReader haar, int point) throws java.io.FileNotFoundException, java.io.IOException
file
- the name of the file containing the list of images and templatehaar
- the face detectororientation
- idicates that we want to try and learn detectors that give us the orientationplist
- the list of points to use from the templates
java.io.FileNotFoundException
java.io.IOException
public FloatImage buildFilterBoosted(java.lang.String file, HaarReader haar, int point) throws java.io.FileNotFoundException, java.io.IOException
file
- the name of the file containing the list of images and templatehaar
- the face detectororientation
- idicates that we want to try and learn detectors that give us the orientationplist
- the list of points to use from the templates
java.io.FileNotFoundException
java.io.IOException
public FloatImage iterateBoosted(java.util.ArrayList<Complex[]> imagesFT, java.util.ArrayList<Complex[]> responsesFT, java.util.ArrayList<java.awt.geom.Point2D.Float> points, java.util.ArrayList<Complex[]> imagesFTTest, java.util.ArrayList<java.awt.geom.Point2D.Float> pointsTest, int[] dim)
file
- the name of the file containing the list of images and templatehaar
- the face detectororientation
- idicates that we want to try and learn detectors that give us the orientationplist
- the list of points to use from the templates
java.io.FileNotFoundException
java.io.IOException
public java.util.ArrayList<FloatImage> buildFilterMultiply(java.lang.String file, HaarReader haar, int point) throws java.io.FileNotFoundException, java.io.IOException
file
- the name of the file containing the list of images and templatehaar
- the face detectororientation
- idicates that we want to try and learn detectors that give us the orientationplist
- the list of points to use from the templates
java.io.FileNotFoundException
java.io.IOException
public java.util.ArrayList<java.lang.Float> calculateErrors(java.util.ArrayList<Complex[]> images, java.util.ArrayList<java.awt.geom.Point2D.Float> points, int[] dim, java.util.ArrayList<java.lang.Float> maxResp)
public static java.util.ArrayList<java.lang.Float> calculateErrors(Complex[] filterFT, FloatImage priorFimg, java.util.ArrayList<Complex[]> images, java.util.ArrayList<java.awt.geom.Point2D.Float> points, int[] dim, java.util.ArrayList<java.lang.Float> maxResp)
public java.util.ArrayList<java.lang.Float> calculateMultiplyErrors(java.util.ArrayList<FloatImage> filters, java.util.ArrayList<Complex[]> images, java.util.ArrayList<java.awt.geom.Point2D.Float> points, int[] dim, java.util.ArrayList<java.lang.Float> maxResp)
public FloatImage bootstrapBuildFilter(java.lang.String file, HaarReader haar, boolean orientation, int[] plist) throws java.io.FileNotFoundException, java.io.IOException
file
- the name of the file containing the list of images and templatehaar
- the face detectororientation
- idicates that we want to try and learn detectors that give us the orientationplist
- the list of points to use from the templates
java.io.FileNotFoundException
java.io.IOException
public static java.awt.geom.Point2D.Float detectFeature(Complex[] img, Complex[] filt, int[] dim)
public static java.awt.geom.Point2D.Float detectFeature(Complex[] img, Complex[] filt, FloatImage prior, int[] dim)
public void write(java.lang.String dir) throws java.io.IOException
dir
- the folder to write to (filter.fimg, prior.fimg and data.txt are written to this file)
java.io.IOException
public void read(java.lang.String dir) throws java.io.IOException
dir
- the directory to read from (reads filter.fimg, prior.fimg and data.txt)
java.io.IOException
public static FloatImage centre(FloatImage fimg)
fimg
- the filter image to centre
public static FloatImage filter(FloatImage fimg, Complex[] filt, int[] dim)
fimg
- the image to apply the filter tofilt
- the FFT of the filterdim
- the dimensionality data {128, 128}
public static FloatImage filter(FloatImage fimg, FloatImage filt, int[] dim)
fimg
- the image to apply the filter tofilt
- the filterdim
- the dimensionality data {128, 128}
public static FloatImage filter(Complex[] data, Complex[] filt, int[] dim)
fimg
- the image to apply the filter tofilt
- the FFT of the filterdim
- the dimensionality data {128, 128}
public static FloatImage[] filterComplex(FloatImage fimg, Complex[] filt, int[] dim)
fimg
- the image to filterfilt
- the FFT of the complex filterdim
- the dimensionality
public static java.awt.Rectangle detectFace(java.awt.image.BufferedImage bimg, HaarReader haar)
bimg
- the image to look for faces inhaar
-
public static java.awt.Rectangle detectFace(java.awt.image.BufferedImage bimg, HaarReader haar, java.awt.Rectangle prevRect)
bimg
- the image to look for faces inhaar
- the face detectorprevRect
- the previous rectangle, if not null it is added to list of candidate rectangles
public static void testFilter(java.lang.String file, java.util.ArrayList<FloatImage> filters, FloatImage prior, HaarReader haar, int[] plist) throws java.io.FileNotFoundException, java.io.IOException
file
- the file to read image and template names fromfilters
- the filters to useprior
- the prior datahaar
- the face detector
java.io.FileNotFoundException
java.io.IOException
public static void testFilterComplex(java.lang.String file, java.util.ArrayList<FloatImage[]> filters, FloatImage prior, HaarReader haar) throws java.io.FileNotFoundException, java.io.IOException
file
- the file to read image and template names fromfilters
- the filters to useprior
- the prior datahaar
- the face detector
java.io.FileNotFoundException
java.io.IOException
public static void main(java.lang.String[] args) throws java.io.FileNotFoundException, java.io.IOException
args
- the program args, args[0] = list of images and template to build from, args[1] = test list
java.io.FileNotFoundException
java.io.IOException
public static boolean hasNextQuotedString(java.util.Scanner sc)
sc
- the Scanner to read from
public static java.lang.String nextQuotedString(java.util.Scanner sc)
sc
- the Scanner to read from
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |