|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Facemorph.Transformer
public class Transformer
Class to perform prototype (average) based transformations on images.
Constructor Summary | |
---|---|
Transformer()
|
Method Summary | |
---|---|
static java.awt.Image |
averageImages(java.awt.Image[] images,
Template[] templates,
Template averageTemplate,
int outW,
int outH,
java.awt.image.ImageObserver obs,
boolean autoSize,
int normalisation)
Average a set of images |
static java.awt.Image |
averageImages(java.awt.Image[] images,
Template[] templates,
Template averageTemplate,
int outW,
int outH,
java.awt.image.ImageObserver obs,
boolean autoSize,
int normalisation,
TransformerListener warpListener,
TransformerListener averageListener)
Method to create an average from a set of delineated images. |
static java.awt.Image |
averageImagesTexture(java.awt.Image[] images,
Template[] templates,
Template averageTemplate,
int outW,
int outH,
Filter[] filters,
int bm,
java.awt.image.ImageObserver obs,
boolean autoSize,
int normalisation)
Method to create an average from a set of delineated images. |
static java.awt.Image |
averageImagesTexture(java.awt.Image[] images,
Template[] templates,
Template averageTemplate,
int outW,
int outH,
Filter[] filters,
int bm,
java.awt.image.ImageObserver obs,
boolean autoSize,
int normalisation,
TransformerListener warpListener,
TransformerListener averageListener)
Method to create an average from a set of delineated images. |
static java.awt.image.BufferedImage |
caricatureChimeric(java.awt.image.BufferedImage subImg,
java.awt.image.BufferedImage cimg1,
java.awt.image.BufferedImage cimg2,
Template tmplt,
float l1,
float l2,
float wid)
Half face transform on the image (no warping) |
static java.awt.image.BufferedImage |
ImageToBufferedImage(java.awt.Image img,
java.awt.image.ImageObserver iob)
Converts an abstract (unknown type of) Image to a BufferedImage for extra functionality. |
static void |
mask(Template newTemplate,
Mask mask,
java.awt.image.BufferedImage warped,
java.awt.image.BufferedImage transformed)
Mask the colour changes to the array specified |
static java.util.Vector<java.awt.Image> |
morph(java.awt.Image img1,
Template tmp1,
java.awt.Image img2,
Template tmp2,
int steps,
java.awt.image.ImageObserver ob,
boolean fast)
Creates a Morph between two delineated images |
static java.util.Vector<java.awt.Image> |
morph(java.awt.Image img1,
Template tmp1,
java.awt.Image img2,
Template tmp2,
int steps,
java.awt.image.ImageObserver ob,
boolean fast,
java.util.Vector<Template> templates,
TransformerListener listener)
Creates a Morph between two delineated images |
static void |
normaliseColours(Template newTemplate,
Mask mask,
java.awt.image.BufferedImage warped,
java.awt.image.BufferedImage transformed)
Normalise the mean and standard deviation of colours in the masked area |
static java.awt.image.BufferedImage |
shiftColours(java.awt.image.BufferedImage subImg,
java.awt.image.BufferedImage src,
java.awt.image.BufferedImage dst,
double amount)
Perform the colour shifting part of the transform |
static java.awt.image.BufferedImage |
testTransform(int warpType,
Template subTem,
Template srcTem,
Template dstTem,
Template outTem,
java.awt.image.BufferedImage subImg,
java.awt.image.BufferedImage srcImg,
java.awt.image.BufferedImage dstImg,
double shapeAmount,
double colourAmount,
double textureAmount,
Filter[] filters,
int bm,
Mask mask,
boolean samples,
boolean borders,
boolean matchCols,
int normalisation,
int[] normPoints)
Face transform method, more modular version |
static java.awt.image.BufferedImage |
testTransform(int warpType,
Template subTem,
Template srcTem,
Template dstTem,
Template outTem,
java.awt.Image subImg,
java.awt.Image srcImg,
java.awt.Image dstImg,
double shapeAmount,
double colourAmount,
double textureAmount,
Filter[] filters,
int bm,
Mask mask,
boolean samples,
boolean borders,
boolean matchCols,
int normalisation,
int[] normPoints)
Face transform method, more modular version |
static java.awt.image.BufferedImage |
textureTransform(java.awt.image.BufferedImage orig,
java.awt.image.BufferedImage sub,
java.awt.image.BufferedImage src,
java.awt.image.BufferedImage dst,
Filter[] filters,
int bm,
double amount)
Performs a texture (wavelet magnitude) transform on the image |
static java.awt.Image |
transform(Template subjectTemplate,
Template sourceTemplate,
Template destTemplate,
Template newTemplate,
java.awt.Image subjectImg,
java.awt.Image sourceImg,
java.awt.Image destImg,
double shape,
double colour,
double texture,
java.awt.image.ImageObserver ob,
Mask mask,
Filter[] filters,
int bm,
boolean fast,
boolean conts)
Transforms subjectImage using the prototypes given and returns the result. |
static java.awt.Image |
transform(Template subjectTemplate,
Template sourceTemplate,
Template destTemplate,
Template newTemplate,
java.awt.Image subjectImg,
java.awt.Image sourceImg,
java.awt.Image destImg,
double s,
java.awt.image.ImageObserver ob,
boolean fast)
Transforms subjectImage using the prototypes given and returns the result. |
static java.awt.Image |
transform(Template subjectTemplate,
Template sourceTemplate,
Template destTemplate,
Template newTemplate,
java.awt.Image subjectImg,
java.awt.Image sourceImg,
java.awt.Image destImg,
double s,
java.awt.image.ImageObserver ob,
Mask mask,
boolean fast)
Transforms subjectImage using the prototypes given and returns the result. |
static java.awt.Image |
transformBald(Template subjectTemplate,
Template avTemplate,
Template rotAvTemplate,
Template baldAvTemplate,
Template rotBaldAvTemplate,
Template hairAvTemplate,
Template rotHairAvTemplate,
Template newTemplate,
java.awt.Image subjectImg,
java.awt.Image sourceImg,
java.awt.Image destImg,
double s,
java.awt.image.ImageObserver ob,
boolean colour,
boolean fast)
Transforms subjectImage using the prototypes given and returns the result. |
static java.awt.image.BufferedImage |
transformChimeric(int warpType,
Template subTem,
Template srcTem,
Template dstTem,
Template outTem,
java.awt.image.BufferedImage subImg,
java.awt.image.BufferedImage srcImg,
java.awt.image.BufferedImage dstImg,
float leftAmount,
float rightAmount,
float width,
boolean samples,
boolean borders)
Half face transform method |
static java.awt.image.BufferedImage |
warp(int warpType,
java.awt.image.BufferedImage bimg,
Template start,
Template end,
int outW,
int outH,
boolean samples,
boolean borders)
Image warp method |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Transformer()
Method Detail |
---|
public static java.awt.Image transform(Template subjectTemplate, Template sourceTemplate, Template destTemplate, Template newTemplate, java.awt.Image subjectImg, java.awt.Image sourceImg, java.awt.Image destImg, double s, java.awt.image.ImageObserver ob, boolean fast)
subjectTemplate
- The Template outlining the features of subjectImgsourceTemplate
- The (average) Template outlining the features of sourceImgdestTemplate
- The (average) Template outlining the features of destImgnewTemplate
- Template to hold the Template corresponding to the transformed result. Useful for morphing afterwards.subjectImg
- The Image to transformsourceImg
- The (average) image of the source groupdestImg
- The (average) image of the destination groups
- The amount to scale this transform by. 0 = no transform, 1= complete transform.ob
- An ImageObserver used for obtaining Image sizesfast
- Flag indicating whether to use (fast?) linear warping with no sampling along the contours, or (slow?) multi-scale warping with full contour sampling.
public static java.awt.Image transform(Template subjectTemplate, Template sourceTemplate, Template destTemplate, Template newTemplate, java.awt.Image subjectImg, java.awt.Image sourceImg, java.awt.Image destImg, double shape, double colour, double texture, java.awt.image.ImageObserver ob, Mask mask, Filter[] filters, int bm, boolean fast, boolean conts)
mask
- The Mask object defining the boundary of the masked region.subjectTemplate
- The Template outlining the features of subjectImgsourceTemplate
- The (average) Template outlining the features of sourceImgdestTemplate
- The (average) Template outlining the features of destImgnewTemplate
- Template to hold the Template corresponding to the transformed result. Useful for morphing afterwards.subjectImg
- The Image to transformsourceImg
- The (average) image of the source groupdestImg
- The (average) image of the destination groupshape
- The amount to scale the shape transform by. 0 = no transform, 1= complete transform.colour
- The amount to scale the colour transform by. 0 = no transform, 1= complete transform.texture
- The amount to scale the texture transform by. 0 = no transform, 1= complete transform.ob
- An ImageObserver used for obtaining Image sizesfilters
- the filters to use if doint a texture transformfast
- Flag indicating whether to use (fast?) linear warping with no sampling along the contours, or (slow?) multi-scale warping with full contour sampling.bm
- the border model of the wavelet analysis filters (1 symmetric, -1 anti-sym), if doing a texture transformconts
- flag indicating that contours should be sampled along (rather than just using template points)
public static java.awt.Image transform(Template subjectTemplate, Template sourceTemplate, Template destTemplate, Template newTemplate, java.awt.Image subjectImg, java.awt.Image sourceImg, java.awt.Image destImg, double s, java.awt.image.ImageObserver ob, Mask mask, boolean fast)
mask
- The Mask object defining the boundary of the masked region.subjectTemplate
- The Template outlining the features of subjectImgsourceTemplate
- The (average) Template outlining the features of sourceImgdestTemplate
- The (average) Template outlining the features of destImgnewTemplate
- Template to hold the Template corresponding to the transformed result. Useful for morphing afterwards.subjectImg
- The Image to transformsourceImg
- The (average) image of the source groupdestImg
- The (average) image of the destination groups
- The amount to scale this transform by. 0 = no transform, 1= complete transform.ob
- An ImageObserver used for obtaining Image sizesfast
- Flag indicating whether to use (fast?) linear warping with no sampling along the contours, or (slow?) multi-scale warping with full contour sampling.
public static java.awt.image.BufferedImage testTransform(int warpType, Template subTem, Template srcTem, Template dstTem, Template outTem, java.awt.Image subImg, java.awt.Image srcImg, java.awt.Image dstImg, double shapeAmount, double colourAmount, double textureAmount, Filter[] filters, int bm, Mask mask, boolean samples, boolean borders, boolean matchCols, int normalisation, int[] normPoints)
warpType
- the type of warp to usesubTem
- the subject's TemplatesrcTem
- the source group TemplatedstTem
- the target group TemplateoutTem
- the output TemplatesubImg
- the subject imagesrcImg
- the source group imagedstImg
- the target group imageshapeAmount
- the amount to transform the shape bycolourAmount
- the amount to transform the colour bytextureAmount
- the amount to transform the texture byfilters
- the filters to use for texture transformationbm
- the border model (sym=1, anti-sym=-1) to use for the filtersmask
- the mask to use (if any, or null)samples
- sample along template contoursborders
- pin down the bordersmatchCols
- match the colours on the masked areanormalisation
- indicates the kind of normalisation to use, one of ASM.RIGID_BODY_NORMALISATION, ASM.TWO_POINT_NORMALISATION, ASM.THREE_POINT_NORMALISATION or ASM.NO_NORMALISATIONnormPoints
- the normalisation points to use for ASM.TWO_POINT_NORMALISATION or ASM.THREE_POINT_NORMALISATION
Warp.createWarp(int, int, int, int, int, boolean)
public static java.awt.image.BufferedImage testTransform(int warpType, Template subTem, Template srcTem, Template dstTem, Template outTem, java.awt.image.BufferedImage subImg, java.awt.image.BufferedImage srcImg, java.awt.image.BufferedImage dstImg, double shapeAmount, double colourAmount, double textureAmount, Filter[] filters, int bm, Mask mask, boolean samples, boolean borders, boolean matchCols, int normalisation, int[] normPoints)
warpType
- the type of warp to usesubTem
- the subject's TemplatesrcTem
- the source group TemplatedstTem
- the target group TemplateoutTem
- the output TemplatesubImg
- the subject imagesrcImg
- the source group imagedstImg
- the target group imageshapeAmount
- the amount to transform the shape bycolourAmount
- the amount to transform the colour bytextureAmount
- the amount to transform the texture byfilters
- the filters to use for texture transformationbm
- the border model (sym=1, anti-sym=-1) to use for the filtersmask
- the mask to use (if any, or null)samples
- sample along template contoursborders
- pin down the bordersmatchCols
- match the colours on the masked areanormalisation
- indicates the kind of normalisation to use, one of ASM.RIGID_BODY_NORMALISATION, ASM.TWO_POINT_NORMALISATION, ASM.THREE_POINT_NORMALISATION or ASM.NO_NORMALISATIONnormPoints
- the normalisation points to use for ASM.TWO_POINT_NORMALISATION or ASM.THREE_POINT_NORMALISATION
Warp.createWarp(int, int, int, int, int, boolean)
public static java.awt.image.BufferedImage caricatureChimeric(java.awt.image.BufferedImage subImg, java.awt.image.BufferedImage cimg1, java.awt.image.BufferedImage cimg2, Template tmplt, float l1, float l2, float wid)
subImg
- the subject imagecimg1
- the source imagecimg2
- the target imagetmplt
- the shape templatel1
- the amount to transform the leftl2
- the amount to transform the rightwid
- the width of the smoothing band
transformChimeric(int, Facemorph.Template, Facemorph.Template, Facemorph.Template, Facemorph.Template, java.awt.image.BufferedImage, java.awt.image.BufferedImage, java.awt.image.BufferedImage, float, float, float, boolean, boolean)
public static java.awt.image.BufferedImage transformChimeric(int warpType, Template subTem, Template srcTem, Template dstTem, Template outTem, java.awt.image.BufferedImage subImg, java.awt.image.BufferedImage srcImg, java.awt.image.BufferedImage dstImg, float leftAmount, float rightAmount, float width, boolean samples, boolean borders)
warpType
- the type of warp to usesubTem
- the subject TemplatesrcTem
- the source group TemplatedstTem
- the target group TemplateoutTem
- the output TemplatesubImg
- the subject ImagesrcImg
- the source group imagedstImg
- the target group imageleftAmount
- the amount to transform the left siderightAmount
- the amount to transform the right sidewidth
- the width of the smoothing bandsamples
- if true sample along Template contoursborders
- add points to pin down the borders
Warp.createWarp(int, int, int, int, int, boolean)
public static void mask(Template newTemplate, Mask mask, java.awt.image.BufferedImage warped, java.awt.image.BufferedImage transformed)
newTemplate
- the template that defines the maskmask
- the mask labelswarped
- the warped imagetransformed
- the transformed imagepublic static void normaliseColours(Template newTemplate, Mask mask, java.awt.image.BufferedImage warped, java.awt.image.BufferedImage transformed)
newTemplate
- the transformed templatemask
- the mask labelswarped
- the warped imagetransformed
- the transformed imagepublic static java.awt.image.BufferedImage textureTransform(java.awt.image.BufferedImage orig, java.awt.image.BufferedImage sub, java.awt.image.BufferedImage src, java.awt.image.BufferedImage dst, Filter[] filters, int bm, double amount)
orig
- the warped original imagesub
- the warped and colour transformed original imagesrc
- the source group imagedst
- the target group imagefilters
- the filters to usebm
- the border model to useamount
- the amount to transform the textures
public static java.awt.image.BufferedImage warp(int warpType, java.awt.image.BufferedImage bimg, Template start, Template end, int outW, int outH, boolean samples, boolean borders)
warpType
- the type of warp to usebimg
- the original imagestart
- the original Templateend
- the target TemplateoutW
- the output widthoutH
- the output heightsamples
- indicates if contours should be sampledborders
- indicates if the borders should be pinned down
public static java.awt.image.BufferedImage shiftColours(java.awt.image.BufferedImage subImg, java.awt.image.BufferedImage src, java.awt.image.BufferedImage dst, double amount)
subImg
- the warped original imagesrc
- the warped source group imagedst
- the warped target group imageamount
- the amount to transform the colours by
public static java.util.Vector<java.awt.Image> morph(java.awt.Image img1, Template tmp1, java.awt.Image img2, Template tmp2, int steps, java.awt.image.ImageObserver ob, boolean fast)
img1
- The image to start fromtmp1
- The Template outlining the features of img1img2
- The image to end attmp2
- The template outlining the features of img2steps
- The number of steps between the images i.e. the output list will contain steps+1 imagesob
- AN ImageObserver, used for finding Image dimensionsfast
- Flag to indicate if (fast?) linear warping with no contour sampling or (slow?) non-linear warping with full contour sampling.
public static java.util.Vector<java.awt.Image> morph(java.awt.Image img1, Template tmp1, java.awt.Image img2, Template tmp2, int steps, java.awt.image.ImageObserver ob, boolean fast, java.util.Vector<Template> templates, TransformerListener listener)
img1
- The image to start fromtmp1
- The Template outlining the features of img1img2
- The image to end attmp2
- The template outlining the features of img2steps
- The number of steps between the images i.e. the output list will contain steps+1 imagesob
- AN ImageObserver, used for finding Image dimensionsfast
- Flag to indicate if (fast?) linear warping with no contour sampling or (slow?) non-linear warping with full contour sampling.templates
- Vector to hold output array of templateslistener
- used for demonstrating output
public static java.awt.Image averageImages(java.awt.Image[] images, Template[] templates, Template averageTemplate, int outW, int outH, java.awt.image.ImageObserver obs, boolean autoSize, int normalisation)
images
- the images to averagetemplates
- the templates specifying the location and shape of each faceaverageTemplate
- the average face shapeoutW
- the output widthoutH
- the output heightobs
- an image observerautoSize
- flag indicating if the average should be auto resized to fit in the output image sizenormalisation
- the type of normalisation to use ASM.RIGID_BODY_NORMALISATION, ASM.TWO_POINT_NORMALISATION, ASM.NO_NORMALISATION
public static java.awt.Image averageImages(java.awt.Image[] images, Template[] templates, Template averageTemplate, int outW, int outH, java.awt.image.ImageObserver obs, boolean autoSize, int normalisation, TransformerListener warpListener, TransformerListener averageListener)
images
- The array of images to be averaged.templates
- The array of templates outlining the features of the corresponding templates.averageTemplate
- The template in which the average shape description will be placed.outW
- The desired width of the output image.outH
- The desired height of the output image.obs
- An image observer used for getting the height and width of the imagenormalisation
- the type of normalisation to use ASM.RIGID_BODY_NORMALISATION, ASM.TWO_POINT_NORMALISATION, ASM.NO_NORMALISATIONautoSize
- automatically resize the template to fill the output imagewarpListener
- used to display the processaverageListener
- used to display the average emerging
public static java.awt.Image averageImagesTexture(java.awt.Image[] images, Template[] templates, Template averageTemplate, int outW, int outH, Filter[] filters, int bm, java.awt.image.ImageObserver obs, boolean autoSize, int normalisation)
images
- The array of images to be averaged.templates
- The array of templates outlining the features of the corresponding templates.averageTemplate
- The template in which the average shape description will be placed.outW
- The desired width of the output image.outH
- The desired height of the output image.filters
- the filters to usebm
- the border model to use for the filtersobs
- An image observer used for getting the height and width of the imageautoSize
- indicates that the template should be expanded to fill the output imagenormalisation
- the type of normalisation to use ASM.RIGID_BODY_NORMALISATION, ASM.TWO_POINT_NORMALISATION, ASM.NO_NORMALISATION
public static java.awt.Image averageImagesTexture(java.awt.Image[] images, Template[] templates, Template averageTemplate, int outW, int outH, Filter[] filters, int bm, java.awt.image.ImageObserver obs, boolean autoSize, int normalisation, TransformerListener warpListener, TransformerListener averageListener)
images
- The array of images to be averaged.templates
- The array of templates outlining the features of the corresponding templates.averageTemplate
- The template in which the average shape description will be placed.outW
- The desired width of the output image.outH
- The desired height of the output image.filters
- the filters to usebm
- the border model to use for the filtersobs
- An image observer used for getting the height and width of the imageaverageListener
- used to display the averaging processautoSize
- resize the average template to fill the output imagenormalisation
- the type of normalisation to use ASM.RIGID_BODY_NORMALISATION, ASM.TWO_POINT_NORMALISATION, ASM.NO_NORMALISATIONwarpListener
- used to display the warping process
public static java.awt.image.BufferedImage ImageToBufferedImage(java.awt.Image img, java.awt.image.ImageObserver iob)
img
- The image to convertiob
- An image observer (for getting the image size etc)
public static java.awt.Image transformBald(Template subjectTemplate, Template avTemplate, Template rotAvTemplate, Template baldAvTemplate, Template rotBaldAvTemplate, Template hairAvTemplate, Template rotHairAvTemplate, Template newTemplate, java.awt.Image subjectImg, java.awt.Image sourceImg, java.awt.Image destImg, double s, java.awt.image.ImageObserver ob, boolean colour, boolean fast)
avTemplate
- The average templaterotAvTemplate
- The rotated average templatebaldAvTemplate
- the face-on bald average templaterotBaldAvTemplate
- the rotated bald average templatehairAvTemplate
- the face-on with hair average templaterotHairAvTemplate
- the rotated with-hair average templatenewTemplate
- The output template, delineatng the transformed image, useful for further processing.colour
- Flag indicating if to change the colours, false implies just the shape is changedsubjectTemplate
- The Template outlining the features of subjectImgsubjectImg
- The Image to transformsourceImg
- The (average) image of the source groupdestImg
- The (average) image of the destination groups
- The amount to scale this transform by. 0 = no transform, 1= complete transform.ob
- An ImageObserver used for obtaining Image sizesfast
- Flag indicating whether to use (fast?) linear warping with no sampling along the contours, or (slow?) multi-scale warping with full contour sampling.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |